package com.mck.entity;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import com.github.pagehelper.Page;

import java.util.List;

/**
 * @version 1.0.0
 * @Author mck
 * @Date 2025/4/15 下午1:36
 * @注释
 */
@Data
@NoArgsConstructor
@AllArgsConstructor
public class Pagination<T> {
    private Integer currentPage;  // 当前页
    private Integer pageSize;     // 每页数量
    private Long total;           // 总记录数
    private List<T> list;         // 数据列表

    // 新增构造函数，兼容PageHelper的Page对象
    public Pagination(Page<?> page, List<T> list) {
        this.currentPage = page.getPageNum();
        this.pageSize = page.getPageSize();
        this.total = page.getTotal();
        this.list = list;
    }
}
